Arena.mpanel = new BPanel();

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////@

Arena.mpanel.bpanelButtonPush(PButton.enalagi(Arena.mpanel));
Arena.mpanel.bpanelButtonPush(PButton.slideH());

Arena.mpanel.bpanelButtonPush(Arena.mpanel.diataxiButton = new PButton({
	omada: Arena.mpanel.omadaMax,
	img: 'resize.gif',
	title: 'Εναλλαγή διάταξης καφενείου/παρτίδας',
	click: function() {
		Arena.diataxi.enalagi();
	},
}));

Arena.mpanel.bpanelButtonPush(new PButton({
	omada: Arena.mpanel.omadaMax,
	refresh: function() {
		if (this.data('partida'))
		this.
		pbuttonTitleSet('Άποψη καφενείου').
		pbuttonIconSet('kafenio.png');

		else
		this.
		pbuttonTitleSet('Άποψη παρτίδας').
		pbuttonIconSet('partida.png');
	},
	click: function() {
		if (this.data('partida')) {
			Arena.diataxi.prokat(1);
			this.data('partida', false);
		}
		else {
			Arena.diataxi.prokat(2);
			this.data('partida', true);
		}

		this.pbuttonRefresh();
	},
}));

Arena.mpanel.bpanelButtonPush(new PButton({
	omada: Arena.mpanel.omadaMax,
	refresh: function() {
		if (this.data('panoramiki'))
		this.
		pbuttonTitleSet('Οικονομική άποψη').
		pbuttonIconSet('ikonomiki.png');

		else
		this.
		pbuttonTitleSet('Πανοραμική άποψη').
		pbuttonIconSet('panoramiki.png');
	},
	click: function() {
		if (this.data('panoramiki')) {
			Arena.diataxi.prokat(0);
			this.data('panoramiki', false);
		}
		else {
			Arena.diataxi.prokat(3);
			this.data('panoramiki', true);
		}

		this.pbuttonRefresh();
	},
}));

Arena.mpanel.bpanelButtonPush(new PButton({
	id: 'diataxiSave',
	omada: Arena.mpanel.omadaMax,
	img: 'arxio.png',
	title: 'Διατάξεις περιοχών σελίδας',
	click: function() {
		if (Arena.diataxi.frame)
		Arena.diataxi.frameKlisimo();

		else
		Arena.diataxi.frameAnigma();
	},
}));

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////@

Arena.mpanelSetup = function() {
	Arena.mpanel.bpanelRefresh();
	Arena.mpanelDOM = $('#mpanel').
	append(Arena.mpanel.bpanelGetDOM()).
	siromeno({
		init: Arena.enotitaPanelInit,
		moveY: false,
		move: function(dx) {
			var siromeno, dx1, pektisW, kafenioW, trapeziW, partidaW, sizitisiW;

			if (dx === 0) return;
			siromeno = $(window).data('siromeno');
			if (!siromeno) return;

			while (1) {
				dx1 = dx;
				pektisW = Arena.pektisPlatosSet(siromeno.pektisW + dx1);
				dx1 -= pektisW - siromeno.pektisW;

				///////////////////////////////////////

				dx1 = dx - dx1;
				kafenioW = siromeno.kafenioW - dx1;
				if (kafenioW < 0) kafenioW = 0;
				dx1 += kafenioW - siromeno.kafenioW;

				trapeziW = siromeno.trapeziW - dx1;
				if (trapeziW < 0) trapeziW = 0;
				dx1 += trapeziW - siromeno.trapeziW;

				sizitisiW = siromeno.sizitisiW - dx1;
				if (sizitisiW < 0) sizitisiW = 0;
				dx1 += sizitisiW - siromeno.sizitisiW;

				partidaW = siromeno.partidaW - dx1;
				if (partidaW < 0) partidaW = 0;
				dx1 += partidaW - siromeno.partidaW;

				///////////////////////////////////////

				if (!dx1)
				break;

				dx -= dx1;
			}

			Arena.enotitaPlatosSet(pektisW, kafenioW, trapeziW, partidaW, sizitisiW);
		},
	});

	return Arena;
};

Arena.mpanel.bpanelButtonPush(new PButton({
	omada: Arena.mpanel.omadaMax,
	img: 'refresh.png',
	title: 'Επαναφόρτωση σελίδας',
	click: function() {
		self.location = Selida.server;
	},
}));
